jQuery Pocket Primer (The Pocket Primer Series) by Oswald Campesato

jQuery Pocket Primer (The Pocket Primer Series) by Oswald Campesato

Author:Oswald Campesato [Campesato, Oswald]
Language: eng
Format: epub, mobi, pdf
Tags: Computing, Internet
ISBN: 9781938549144
Publisher: Mercury Learning and Information
Published: 2015-03-22T22:00:00+00:00


// The initialize function is like a constructor in that

// it is always called when you instantiate a Backbone View

var search_view = new SearchView();

What is a Collection?

A Collection in BackboneJS is an ordered set of models. Collections are useful because you can include methods inside of them to fetch data from a server, prepare that data before returning the collection, and set sample collections for debugging/testing.

Moreover, you can add event listeners and attach views to collections, which is not the case for simple JavaScript arrays.

As a simple example, we can use the Model Vehicle that we created in the previous section in order to create a Collection in Backbone as follows:

var Cars = Backbone.Collection.extend({

model: Vehicle

});



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.